import request from '../utils/request'
import {
  createAuthHeader
} from '../utils/request'

//获取用户设备号
export async function get_user_devicedId() {
  return  request({
    url: 'device/listByUserId',
    method: 'GET',
    header: createAuthHeader()
  });
}


// 添加设备
export async function deviced_add(deviceId) {
  return request({
    url: 'deviceUser/save/' + deviceId,
    method: 'POST',
    header: createAuthHeader(),
  });
}

// 移除设备
export async function deviced_delete(deviceId) {
  return request({
    url: 'deviceUser/remove/' + deviceId,
    method: 'DELETE',
    header: createAuthHeader(),
  });
}

//设备上升
export async function deviced_up(deviceId, time) {
  return request({
    url: 'control/up',
    method: 'POST',
    header: createAuthHeader(),
    data: {
      deviceId,
      time
    }
  });
}

//设备下降
export async function deviced_down(deviceId, time) {
  return request({
    url: 'control/down',
    method: 'POST',
    header: createAuthHeader(),
    data: {
      deviceId,
      time
    }
  });
}

//设备拍照
export async function deviced_camera(deviceId) {
  return request({
    url: 'control/capture/' + deviceId,
    method: 'POST',
    header: createAuthHeader(),
  });
}


